home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
science
/
sm32a.zip
/
SYMBMATH.H49
< prev
next >
Wrap
Text File
|
1994-12-22
|
3KB
|
84 lines
5.2. Plotting y = f(x)
You can plot a function of y = f(x) on the xy-plane by a single
external function
plot(f(x),x)
plot(f(x),x,xmin,xmax)
plot(f(x),x,xmin,xmax,ymin,ymax)
plot(f(x),x,xmin,xmax,ymin,ymax,color)
f(x) can be either a function with bound variable x or an expression
involving x. For example, you could graph the parabola with the command
plot(x^2,x).
The xmin and xmax are range of x-axis, the ymin and ymax are range of
y-axis. The default values are xmin=-5, xmax=5, ymin=-5, and ymax=5.
The values of xmin, xmax, ymin, ymax are real numbers, such that
xmin < xmax and ymin < ymax. Thses values tell SymbMath that the
visible screen corresponds to a portion of the xy-plane with
xmin <= x <= xmax and ymin <= y <= ymax.
The operator plot() plots one point (x,f(x)) for each pixel on the
x-axis, and connects successive points. To omit the connections and just
plot the points, use the command:
dotplot(f(x),x)
To plot only every 20th point, which is useful for rapidly
graphing complicated functions, use
sketch(f(x),x)
If you want your circles and squares to look correct --
that is, if you want one vertical unit to be really the same
distance as one horizontal unit--you should select window
parameters so that the horizontal axis is 1.4 times as long as
the vertical axis.
Example 5.2:
plot x^3 and sin(x).
IN: graph
IN: plot(x^3,x)
IN: plot(sin(x),x)
5.3 Plotting parametric functions x=x(t) and y=y(t)
You can plot the parametric functions of x=x(t) and y=y(t) by
paraplot(x(t),y(t),t)
paraplot(x(t),y(t),t,tmin,tmax)
paraplot(x(t),y(t),t,tmin,tmax,ymin,ymax)
e.g.
IN: graph
IN: paraplot(sin(t),sin(2*t),t)
5.4 Plotting r = f(t) in polar coordinates
You can graph the portion of a polar curve r = f(t) that lies in
the window with a single external function:
polaplot(f(t),t)
polaplot(r, t,tmin,tmax)
polaplot(r, t,tmin,tmax,rmin,rmax)
f(t) can be a function with bound variable t or an expression involving t.
For example, to graph a circle r = 1, execute the command
polaplot(1,t)
The variable t covers the domain (0, 2π); you can change this default by
specifying a range for t:
polaplot(1, t,0,pi)
5.5 Plotting data
You can plot data by
dataplot([x1,x2,...], [y1,y2,...])
dataplot([x1,x2,...], [y1,y2,...], xmin,max)
dataplot([x1,x2,...], [y1,y2,...], xmin,xmax,ymin,ymax)
dataplot([x1,x2,...], [y1,y2,...], xmin,xmax,ymin,ymax,link)
e.g.
IN: graph
IN: dataplot([1,2,3], [1,4,9])
You can plot a list of data by
listplot([y1,y2,...])
for x1=1, x2=2, x3=3, ....
e.g.
IN: graph
IN: listplot([1,4,9])
You can fit a set of data into a function x^2
e.g.
IN: graph
IN: dataplot([1,2,3,4],[1,4,9,16],0,5,0,20)
IN: plot(x^2,x,0,5,0,20)